package com.xyh.affairs.netty;

import com.alibaba.fastjson.JSONObject;
import com.xyh.affairs.communication.TransactionMs;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @version v1.0
 * @类描述：
 * @项目名称：
 * @包名： com.xyh.affairs.utils
 * @类名称：NettyClient
 * @创建人：YIHANG.XU
 * @创建时间：2020/8/811:23 上午
 * @修改人：YIHANG.XU
 * @修改时间：2020/8/811:23 上午
 * @修改备注：
 * @Copyright
 */
public class NettyClient  {
   private static ExecutorService service = Executors.newCachedThreadPool();
   //接收消息
   public void channelRead(Object msg){
      JSONObject jsonObject = JSONObject.parseObject((String) msg);
      String groupId = jsonObject.getString("groupId");
      String command = jsonObject.getString("command");
      TransactionMs.getTransaction(groupId).setTransactionType(command);
      TransactionMs.getTransaction(groupId).getTask().signalTask();

   }

}
